#!/bin/sh

#################################################
# FUNCTIONS
#################################################


var_lognplay_dir='./../'
var_collector_dir='./../lognplay/collector/'
var_jar_dir='./../lognplay/collector/collectorService/target/collectorService-1.0-SNAPSHOT-jar-with-dependencies.jar'

svnUpdate() {

	echo "update ? (y/n)"
	read var_update

	if [ "$var_update" = "y" ]; then
		echo "\n\n"
		svn update $var_lognplay_dir
	fi

}

mvnPackage() {
	
	echo "rebuild ? (y/n)"
	read var_build

	if [ "$var_build" = "y" ]; then
		echo "\n\n\n"
		cd $var_collector_dir
		mvn package 
	fi

}

runCollector() {

	clear
	sudo java -jar $var_jar_dir

}

#################################################
# MAIN
#################################################

svnUpdate

mvnPackage

runCollector

